/*
 * LogsTableCellRenderer.java
 *
 * Created on July 16, 2006, 1:42 AM
 *
 */

package org.vcboard.view.renderer;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import org.apache.log4j.Logger;

/**
 * @author Josh
 */
public class LogsTableCellRenderer
      extends DefaultTableCellRenderer
{
   private Logger log = Logger.getLogger(LogsTableCellRenderer.class);
   private Color odd = new Color(255, 255, 255);
   private Color even = new Color(237, 237, 237);
   private Color black = new Color(0, 0, 0);
   private Color white = new Color(255, 255, 255);
   private Color selected = new Color(41, 85, 140);
   
   /** Creates a new instance of LogsTableCellRenderer */
   public LogsTableCellRenderer()
   {
      setOpaque(true);
   }

   public Component getTableCellRendererComponent(
         JTable table, Object value, 
         boolean isSelected, boolean hasFocus, 
         int row, int column)
   {
      super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
      
      if (row % 2 == 0)
      {
         setBackground(odd);
      }
      else
      {
         setBackground(even);
      }
      setForeground(black);
      
      if (isSelected)
      {
         setBackground(selected);
         setForeground(white);
      }
      
      return this;
   }
   
}
